package com.jrmf.redenvelopes.order.common;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableAutoConfiguration
public class SwaggerConfig {

	@Bean
	public Docket api() {
		return new Docket(DocumentationType.SWAGGER_2).pathMapping("/").select()
				.apis(RequestHandlerSelectors.basePackage("com.jrmf.redenvelopes.order.controller")).build().apiInfo(apiInfo());
	}

	private ApiInfo apiInfo() {
		ApiInfo apiInfo = new ApiInfo("清结算系统", // 大标题
				"REST SETTLEMENT DOMAIN API", // 小标题
				"1.0", // 版本
				"weixf05", // 作者
				new Contact("金融魔方", "", ""), "The Apache License, Version 2.0", // 链接显示文字
				"https://www.jrmf.com"// 网站链接
		);

		return apiInfo;
	}
}